﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Web.Configuration;

namespace FlexiCommerce.Configuration
{
    public class EngineSection : ConfigurationSection
    {
        [ConfigurationProperty("castleConfiguration", DefaultValue = "assembly://FlexiCommerce/Configuration/castle.config")]
        public string CastleConfiguration
        {
            get { return (string)base["castleConfiguration"]; }
            set { base["castleConfiguration"] = value; }
        }

        /// <summary>In addition to configured assemblies examine and load assemblies in the bin directory.</summary>
        [ConfigurationProperty("dynamicDiscovery", DefaultValue = true)]
        public bool DynamicDiscovery
        {
            get { return (bool)base["dynamicDiscovery"]; }
            set { base["dynamicDiscovery"] = value; }
        }

        /// <summary>Read the windsor inversion of control container configuration from this configuration section instead of the location configured by <see cref="CastleConfiguration"/>.</summary>
        [ConfigurationProperty("castleSection")]
        public string CastleSection
        {
            get { return (string)base["castleSection"]; }
            set { base["castleSection"] = value; }
        }

        /// <summary>Additional assemblies assemblies investigated while investigating the environemnt.</summary>
        [ConfigurationProperty("assemblies")]
        public AssemblyCollection Assemblies
        {
            get { return (AssemblyCollection)base["assemblies"]; }
            set { base["assemblies"] = value; }
        }

        [ConfigurationProperty("errors")]
        public ErrorsElement Errors
        {
            get { return (ErrorsElement)base["errors"]; }
            set { base["errors"] = value; }
        }


        /// <summary>Scheduler related configuration.</summary>
        [ConfigurationProperty("scheduler")]
        public SchedulerElement Scheduler
        {
            get { return (SchedulerElement)base["scheduler"]; }
            set { base["scheduler"] = value; }
        }

        /// <summary>A collection of services that are registered in the container before the default ones. This is a place through which core services can be replaced.</summary>
        [ConfigurationProperty("components")]
        public ComponentCollection Components
        {
            get { return (ComponentCollection)base["components"]; }
            set { base["components"] = value; }
        }

        [ConfigurationProperty("installer")]
        public InstallerElement Installer
        {
            get { return (InstallerElement)base["installer"]; }
            set { base["editTreeUrl"] = value; }
        }

        [ConfigurationProperty("enableGlobalization", DefaultValue = "true")]
        public bool EnableGlobalization
        {
            get { return (bool)base["enableGlobalization"]; }
            set { base["enableGlobalization"] = value; }
        }


        [ConfigurationProperty("urlFormating")]
        public UrlFormatingElement UrlFormating
        {
            get { return (UrlFormatingElement)base["urlFormating"]; }
            set { base["urlFormating"] = value; }
        }

    }
}
